program CodeGenerator;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  sysutils, Classes, BPeaUnit, BModelGeneratorUnit, BModelCodePartsUnit,
  BHolderGeneratorUnit, BGeneratorUnit, BCodeGenUnit, BSQLGeneratorUnit,
  BControllerCodePartsUnit, BControllerGeneratorUnit;

begin
  If (Paramcount = 0) Or Not(DirectoryExists(ParamStr(1))) Then
    Begin
      WriteLn('Unable get project path');
      Exit;
    End;

  With BCodeGenClass.Build Do
    Begin
      Try
      ProjectPath := ParamStr(1);
      UpdateAll;

      Except On E: Exception Do
        WriteLn(E.Message);
      End;
      Burn;
    End;
end.

